//
//  ForEachBootcamp.swift
//  FCSwiftUI
//
//  Created by 冯宣超 on 2023/2/20.
//

import SwiftUI

struct ForEachBootcamp: View {
    
    let data: [String] = ["Hi", "hello", "Hey, everyone"]
    
    var body: some View {
        VStack(spacing: 20) {
            ForEach(data.indices, id: \.self) { index in
                Text("\(data[index]):\(index)")
            }
            
            Spacer()
            
            HStack {
                ForEach(0..<10) { index in
                    Circle()
                        .frame(width: 50)
                        .overlay {
                            Text(String(index))
                                .font(.headline)
                                .foregroundColor(.white)
                        }
                }
            }
        }
        
    }
}

struct ForEachBootcamp_Previews: PreviewProvider {
    static var previews: some View {
        ForEachBootcamp()
    }
}
